﻿using Model;
using System;
using System.Collections.Generic;
using System.Data.Entity;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace DAL
{
    public class DBFactory : DbContext
    {
        public DBFactory()
            : base("EFDbContext")
        {

        }
        protected override void OnModelCreating(DbModelBuilder modelBuilder)
        {
            modelBuilder.Entity<FactoryEntity>().ToTable("OAS.Factory");
            modelBuilder.Entity<GeneralGoodsReceiptEntity>().ToTable("OAS.GeneralGoodsReceipt");
            modelBuilder.Entity<GeneralTaskDetailEntity>().ToTable("OAS.GeneralTaskDetail");
            modelBuilder.Entity<GeneralTaskEntity>().ToTable("OAS.GeneralTask");
            modelBuilder.Entity<ItemCodeMappingEntity>().ToTable("OAS.ItemCodeMapping");
            modelBuilder.Entity<MixedTaskCenterEntity>().ToTable("OAS.MixedTaskCenter");
            modelBuilder.Entity<MonthlyPlannedQtyEntity>().ToTable("OAS.MonthlyPlannedQty");
            modelBuilder.Entity<ProcessEntity>().ToTable("OAS.Process");
            modelBuilder.Entity<ReceiptEntity>().ToTable("OAS.Receipt");
            modelBuilder.Entity<SecurityUserFactoryMappingEntity>().ToTable("OAS.SecurityUserFactoryMapping");
            modelBuilder.Entity<SecurityUserRoleMappingEntity>().ToTable("DCL.SecurityUserRoleMapping");
            modelBuilder.Entity<SupplierListEntity>().ToTable("OAS.SupplierList");
            modelBuilder.Entity<TaskDeductionEntity>().ToTable("OAS.TaskDeduction");
            modelBuilder.Entity<TaskPackageDetailEntity>().ToTable("OAS.TaskPackageDetail");
            modelBuilder.Entity<TaskPackageEntity>().ToTable("OAS.TaskPackage");
            modelBuilder.Entity<TaskPackageStatusEntity>().ToTable("OAS.TaskPackageStatus");
            modelBuilder.Entity<TaskStatusEntity>().ToTable("OAS.TaskStatus");
            modelBuilder.Entity<WorkflowNodeEntity>().ToTable("OAS.WorkflowNode");
            modelBuilder.Entity<WorkflowRoleEntity>().ToTable("OAS.WorkflowRole");
            modelBuilder.Entity<WorkflowRoutingEntity>().ToTable("OAS.WorkflowRouting");
            modelBuilder.Entity<WorkflowRoutingHistoryEntity>().ToTable("OAS.WorkflowRoutingHistory");
            modelBuilder.Entity<WorkflowTypeEntity>().ToTable("OAS.WorkflowType");

            modelBuilder.Entity<SecurityUserEntity>().ToTable("DCL.SecurityUser");
            modelBuilder.Entity<SecurityRoleEntity>().ToTable("DCL.SecurityRole");
            base.OnModelCreating(modelBuilder);
        }
        public DbSet<FactoryEntity> FactoryFactory { get; set; }
        public DbSet<SecurityUserEntity> SecurityUserFactory { get; set; }
        public DbSet<SecurityRoleEntity> SecurityRoleFactory { get; set; }
        public DbSet<GeneralGoodsReceiptEntity> GeneralGoodsReceiptFactory { get; set; }
        public DbSet<GeneralTaskDetailEntity> GeneralTaskDetailFactory { get; set; }
        public DbSet<GeneralTaskEntity> GeneralTaskFactory { get; set; }
        public DbSet<ItemCodeMappingEntity> ItemCodeMappingFactory { get; set; }
        public DbSet<MixedTaskCenterEntity> MixedTaskCenterFactory { get; set; }
        public DbSet<MonthlyPlannedQtyEntity> MonthlyPlannedQtyFactory { get; set; }
        public DbSet<ProcessEntity> ProcessFactory { get; set; }
        public DbSet<ReceiptEntity> ReceiptFactory { get; set; }
        public DbSet<SecurityUserFactoryMappingEntity> SecurityUserFactoryMappingFactory { get; set; }
        public DbSet<SecurityUserRoleMappingEntity> SecurityUserRoleMappingFactory { get; set; }
        public DbSet<SupplierListEntity> SupplierListFactory { get; set; }
        public DbSet<TaskDeductionEntity> TaskDeductionFactory { get; set; }
        public DbSet<TaskPackageDetailEntity> TaskPackageDetailFactory { get; set; }
        public DbSet<TaskPackageEntity> TaskPackageFactory { get; set; }
        public DbSet<TaskPackageStatusEntity> TaskPackageStatusFactory { get; set; }
        public DbSet<TaskStatusEntity> TaskStatusFactory { get; set; }
        public DbSet<WorkflowNodeEntity> WorkflowNodeFactory { get; set; }
        public DbSet<WorkflowRoleEntity> WorkflowRoleFactory { get; set; }
        public DbSet<WorkflowRoutingEntity> WorkflowRoutingFactory { get; set; }
        public DbSet<WorkflowRoutingHistoryEntity> WorkflowRoutingHistoryFactory { get; set; }
        public DbSet<WorkflowTypeEntity> WorkflowTypeFactory { get; set; }
    }
}
